Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 27, 2026

send_chat_history was short-circuiting on empty chat_history_messages, returning success without making the HTTP request. The MCP platform requires the request even with empty chat history.

Changes

  • Core service: Removed early return that bypassed HTTP call when list is empty
  • Documentation: Updated docstring to reflect that empty lists are valid and will send requests
  • Tests: Updated test to verify HTTP request is made with empty chatHistory payload

Before

if len(chat_history_messages) == 0:
    self._logger.warning("Empty message list provided to send_chat_history")
    return OperationResult.success()  # No HTTP request made

After

# Note: Empty chat_history_messages is allowed - we still send the request to MCP platform
# The platform needs to receive the request even with empty chat history

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • il-1234567812345678123456781234567.8.tenant.api.powerplatform.com
    • Triggering command: /home/REDACTED/work/Agent365-python/Agent365-python/.venv/bin/pytest pytest tests/ -v --tb=short -m not integration (dns block)
  • il-testtenan.t.tenant.api.powerplatform.com
    • Triggering command: /home/REDACTED/work/Agent365-python/Agent365-python/.venv/bin/pytest pytest tests/ -v --tb=short -m not integration (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

On mcp_tool_server_configuration_service.py, In send_chat_history, if chat_history_messages is empty we immediately short-circuit the call and return success. This is incorrect - we need to allow the call to pass and we need to send a request with empty chat history to MCP platform. Please update this. Make sure to update any tests and if there is any documentation related to this behavior, that will also need to be updated.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…ssages

- Removed early return for empty chat_history_messages that was short-circuiting HTTP request
- Updated docstring to document that empty lists are allowed and will still send request
- Updated unit test to verify HTTP requests are made with empty chat history
- Moved json import to top of test file

Co-authored-by: pontemonti <[email protected]>
Copilot AI changed the title [WIP] Fix incorrect short-circuit in send_chat_history method Fix send_chat_history to send request with empty chat history Jan 27, 2026
Copilot AI requested a review from pontemonti January 27, 2026 06:01
@pontemonti pontemonti marked this pull request as ready for review January 27, 2026 06:07
@pontemonti pontemonti requested a review from a team as a code owner January 27, 2026 06:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes send_chat_history so it no longer short-circuits on an empty chat_history_messages list and instead sends the required MCP platform request (with an empty chatHistory payload).

Changes:

  • Removed the early return that previously skipped the HTTP request when chat_history_messages was empty.
  • Updated the send_chat_history docstring to document that empty lists are valid and still result in a request.
  • Updated unit tests to assert that an HTTP POST is made and that the serialized payload contains chatHistory: [].

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
tests/tooling/services/test_send_chat_history.py Updates the empty-list test to verify an HTTP request is made and includes an empty chatHistory array.
libraries/microsoft-agents-a365-tooling/microsoft_agents_a365/tooling/services/mcp_tool_server_configuration_service.py Removes empty-list short-circuit and updates documentation to reflect the new behavior.

@pontemonti pontemonti enabled auto-merge (squash) January 27, 2026 06:10
@pontemonti pontemonti merged commit accc8a3 into main Jan 27, 2026
14 checks passed
@pontemonti pontemonti deleted the copilot/update-send-chat-history-behavior branch January 27, 2026 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants